<?php /*
	*/ ?>
<?php include("system/config.inc.php");
$donotinclude = 1;
if(!isset($_SESSION['memberid'])){
	header("location:customerlogin.php");
	die();
}
// check customer basket is empty or not
$id=$_SESSION['memberid'];
if(isset($_SESSION['memberid']) && trim($_SESSION['memberid']!="")) {
	$id = $_SESSION['memberid'];
	$sqlbask="select * from tblcustomerbaskets where intcustomerid='$id'";
	$resbask=$n02586916_db->select($sqlbask);
	if(count($resbask)==0) {
		header("location:cart.php");
		die();
	}
} else if(isset($_SESSION['custid']) && ($_SESSION['custid']!="")) {
$id= $_SESSION['custid'];
$sqlbask="select * from tblcustomerbaskets where intcustomerid='$id'";
$resbask=$n02586916_db->select($sqlbask);
	if(count($resbask)==0) {
		header("location:cart.php");
		die();
	}
}
if(isset($_REQUEST['ship']) && ($_REQUEST['ship'])!=""){
	$ship=$_REQUEST['ship'];
}
				
			$sql="select * from tblcustomeradd where intcustomerid='$id'";
			$res=$n02586916_db->select($sql);
			
			$paddress=$res[0]['varbillingstreetaddress'];
			$pcity=$res[0]['varbillingcity'];
			$pcode=$res[0]['varbillingpostcode'];
			$pstate=$res[0]['varbillingstate'];
			$pcont=$res[0]['varbillingcountry'];
			$addarr = explode(" ",$paddress,2);

			if($_REQUEST['a']=="1") {
			$houseno = $_REQUEST['houseno'];
			$add = $_REQUEST['address'];
			$city = $_REQUEST['city'];
			$code = $_REQUEST['code'];
			$state = $_REQUEST['state'];
			$con = $_REQUEST['country'];
					$sql_upd ="UPDATE `tblcustomeradd` SET 
							`varbillingstreetaddress` = '$houseno $add', 
							`varbillingcity` = '$city',
							`varbillingpostcode`='$code',
							`varbillingstate`='$state',
							`varbillingcountry`='$con' 
							WHERE `intcustomerid`=$id";
					$sql=$n02586916_db->edit($sql_upd);
					
				$sql="select * from tblcustomeradd where intcustomerid=$id";
				$res=$n02586916_db->select($sql);
				
				$paddress=$res[0]['varbillingstreetaddress'];
				$pcity=$res[0]['varbillingcity'];
				$pcode=$res[0]['varbillingpostcode'];
				$pstate=$res[0]['varbillingstate'];
				$pcont=$res[0]['varbillingcountry'];
				$addarr = explode(" ",$paddress,2);
			}
?>
<?php include("inc/head.inc.php");?>
<body>
<table width="824" border="0" cellpadding="0" cellspacing="0"  align="center">
  
  <tr>
    <td class="headerclass"><?php include(INC."top.inc.php") ?></td>
  </tr>
  <tr>
    <td valign="top" class="maincontainer"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr><td valign="top"class="leftmenuback"><?php include(INC."left.inc.php") ?></td>
        <td valign="top">
		<table width="98%" border="0" align="center" cellpadding="0" cellspacing="5">
        <tr>
          <td width="100%" height="23" bgcolor="#000000" class="style1">&nbsp; Payment Information </td>
        </tr>
		 <tr>
		   <td height="23" align="right" valign="middle" class="staus"><img src="images/back.gif" onClick="history.go(-1);" border="0"/></td>
	    </tr>
		 <tr>
           <td height="23" valign="middle" class="font">&nbsp; <span class="font">&nbsp;1&nbsp;&nbsp;confirm</span> | <span class="font">&nbsp;2&nbsp;&nbsp;postage</span> | <span class="price">&nbsp;3&nbsp;&nbsp;pay</span> | <span class="font">&nbsp;5&nbsp;&nbsp;Discount Codes</span> | <span class="font">&nbsp;5&nbsp;&nbsp;Order Confirmation</span></td>
	    </tr>
        <tr>
          <td align="center">
		  <table width="100%" border="0" cellpadding="0" cellspacing="2" class="proborder">
            <tr>
              <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;" colspan="2">&nbsp;Billing Address </td>
              </tr>
            <tr>
              <td width="71%" class="font">If the <strong>Billing Address</strong> shown right is incorrect use the form at the bottom make a change.<br /></td>
              <td width="29%" valign="top" class="fontsmall" align="left"><strong>Billing Address </strong></td>
            </tr>
            <tr>
              <td rowspan="2"> </td>
              <td class="font" align="left"><?php echo 
			   $paddress."<br>".
			   $pcity."<br>".
			   $pcode."<br>".
			   $pstate."<br>".
			   $pcont; ?></td>
            </tr>
          </table>
		  <br />
		  <table width="100%" border="0" cellpadding="0" cellspacing="2" class="proborder">
            <tr>
             <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;" colspan="3">&nbsp;Payment Method </td>
            </tr>
            <tr align="center">
              <td class="font">Pay Pal</td>
              <td class="fontsmall"><input name="radiobutton" type="radio" value="1" checked="checked" /></td>
			  <td class="fontsmall">Fast Safe and Secure payment via paypal</td>
            </tr>
          </table>
		  <br /><br />
	<form name="editship" action="checkoutpayment.php?ship=<?php echo $ship;?>&a=1" method="post">
	<table width="100%" border="0" cellpadding="0" cellspacing="2" class="proborder">
  <tr>
    <td colspan="5" class="font">Please use the following form to update your billing address to use for this   order.</td>
    </tr>

  <tr>
    <td>&nbsp;</td>
    <td class="font">House Number* </td>
    <td>:</td>
    <td><input name="houseno" type="text" class="feature_headingbg" id="houseno" value="<?php echo $addarr[0];?>" /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td class="font">Street Name* </td>
    <td>:</td>
    <td><input name="address" type="text" class="feature_headingbg" id="address" value="<?php echo $addarr[1];?>" /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td class="font">Town* </td>
    <td>:</td>
    <td><input name="city" type="text" class="feature_headingbg" id="city"  value="<?php echo $pcity; ?>"  /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td class="font">Postal Code* </td>
    <td>:</td>
    <td><input name="code" type="text" class="feature_headingbg" id="code"  value="<?php echo $pcode;?>" /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td class="font">County </td>
    <td>:</td>
    <td><input name="state" type="text" class="feature_headingbg" id="state" value="<?php echo $pstate;?>"  /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td class="font">Country </td>
    <td>:</td>
    <td><input name="country" type="text" class="feature_headingbg" id="country" value="<?php echo $pcont; ?>"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr class="fontsmall">
    <td colspan="5" align="center">&nbsp;</td>
  </tr>
  <tr class="fontsmall">
    <td colspan="5" align="center">
      <input name="Submit" type="submit" class="feature_headingbg" value="Update" />
	  <br /><br /> 
	 Fields marked with a * are required items and must be completed before you can continue.
	  </td>
    </tr>
</table>
	</form>
		  <table width="100%" border="0" cellpadding="0" cellspacing="3" class="proborder">
      <tr>
        <td width="63%" align="left" class="msg1">Continue Checkout Procedure
to confirm this order.</td>
		<td width="37%" align="right">
		<?php if (strlen($paddress)>1 && strlen($pcity)>1 && strlen($pcode)>1) {?>
		<a href="checkfidetail.php?ship=<?php echo $ship;?>" class="ab"><img src="images/continue.gif" border="0" /></a>
		<?php } ?>
		</td>
      </tr>
    </table>		  </td>
        </tr> 
      </table>		</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><?php include "inc/bottom.inc.php"; ?></td>
  </tr>
</table>
</body>
</html>
